/**
 * 
 */
package com.sidom.movieIndexer.service.clean.strategy;

import java.util.Set;

import static org.apache.commons.lang.Validate.notNull;
import org.springframework.stereotype.Service;

/**
 * Strategy that will replace non alphanumeric characters with a white space or custom defined character.
 * 
 * @author Siebe
 */
@Service
public class RemoveNonAlphaNumericCharacterStrategy implements CleanFileNameStrategy{
	/**
	 * {@inheritDoc}
	 */
	@Override
	public String cleanFileName(final String fileName, final Set<String> wordsToRemove) {
		notNull(fileName, "fileName can not be null");
	    return fileName.replaceAll("[^a-zA-Z0-9]", " ").trim();
	}
}
